package com.fly.order.controller;

import com.fly.order.client.ProductClient;
import com.fly.order.domain.ProductInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * @author Fly
 * @Description
 * @Date Created in 9:10 2018/3/31
 * @Modified by
 */
@RestController
@Slf4j
public class ClientController {

    @Autowired
    private ProductClient productClient;

    @GetMapping("getProductMsg")
    public String getProductMsg(){

        //feign
        String response = productClient.getProductMsg();
        log.info("response={}" , response);
        System.out.println("test");
        return response;
    }

    @GetMapping("getProductList")
    public String getProductList(){
        List<ProductInfo> productInfoList = productClient.listForOrder(Arrays.asList("157875196366160022","157875227953464068"));
        log.info("response={}",productInfoList);
        return "ok";
    }
}
